package org.qingke.mail.user.service.controller;

import org.qingke.mail.common.SearchProperty;
import org.qingke.mail.common.ServerResponse;
import org.qingke.mail.domain.TbUser;
import org.qingke.mail.user.service.provider.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.github.pagehelper.PageHelper;


/**
 * 用户服务入口
 * @author JAVA
 *
 */
@RestController
@RequestMapping("/user")
public class UserServiceController {
	
	@Autowired
	private UserService userService;
	
	@RequestMapping(value="/insert",method={RequestMethod.POST})
	public ServerResponse insert(@RequestBody TbUser user){
		return userService.insert(user);
	}
    
	@RequestMapping(value="/queryByProperty",method={RequestMethod.GET})
	public ServerResponse queryByProperty(SearchProperty searchProperty){
		PageHelper.startPage(0, 1,false);
		return userService.queryByProperty(searchProperty);
	}
}
